package com.touch.workshop.ui.library;
import java.awt.dnd.DnDConstants;
import javax.swing.*;
import javax.swing.tree.*;
public class LibraryCollection extends JInternalFrame
{
	private static final long serialVersionUID = -5251823611702765186L;	
	
	protected JTree treeview;	
	protected DefaultMutableTreeNode root		= new DefaultMutableTreeNode("Libraries");
	protected DefaultMutableTreeNode clientLib 	= new DefaultMutableTreeNode("Client");
	protected DefaultMutableTreeNode serverLib 	= new DefaultMutableTreeNode("Server");
	protected DefaultMutableTreeNode sprites 	= new DefaultMutableTreeNode("Sprites");
	protected DefaultMutableTreeNode tiles 		= new DefaultMutableTreeNode("Tiles");
	protected DefaultMutableTreeNode sound 		= new DefaultMutableTreeNode("Sound Effects");
	protected DefaultMutableTreeNode music 		= new DefaultMutableTreeNode("Music");
	protected DefaultMutableTreeNode GUI 		= new DefaultMutableTreeNode("GUI");
	protected DefaultMutableTreeNode animations = new DefaultMutableTreeNode("Animations");
	protected DefaultMutableTreeNode data 		= new DefaultMutableTreeNode("Data");
	protected DefaultMutableTreeNode scripts 	= new DefaultMutableTreeNode("Scripts");
	
	public LibraryCollection()
	{
		super("Resources", true, true, true, true);
		this.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
		
		treeview = new JTree(root);				
		
		root.add(clientLib);
		root.add(serverLib);
		
		clientLib.add(sprites);
		clientLib.add(tiles);
		clientLib.add(sound);
		clientLib.add(music);
		clientLib.add(GUI);
		clientLib.add(animations);
		
		serverLib.add(data);
		serverLib.add(scripts);
		
		
		//new RemoteTransferListener(treeview);
		new TreeDragSource(treeview, DnDConstants.ACTION_COPY_OR_MOVE);
	    new TreeDropTarget(treeview);	
	    new NodeHandler(treeview);
		this.setSize(240, 640);
		this.add(new JScrollPane(treeview));				
	}	
}
